package com.example.chapter2;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;

/**
 * 
 * @author songsungkyun
 *
 */
public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    public void button_pressed(View view) {
    	//TextView textView = (TextView) this.findViewById(R.id.textView1);
    	//textView.setText("OK");
    	
//    	Intent intent = new Intent(this, RedActivity.class);
//    	intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
//    	this.startActivityForResult(intent, 100);
    	
    	
    }

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (requestCode == 100) {
			if (resultCode == RESULT_OK) {
				String result = data.getExtras().getString("result");
				TextView textView = (TextView) this.findViewById(R.id.textView1);
		    	textView.setText(result);
			}
		}
	}
    
    
}